;;; +centaur-tabs.el --- Initialization and mode setting.

;;; Homepage:
;; https://github.com/ema2159/centaur-tabs

;;; Commentary:
;; Tab display.

;;; Code:

(use-package centaur-tabs
  :ensure
  :hook
  (emacs-startup . centaur-tabs-mode)
  :bind
  ("C-x C-g" . centaur-tabs-switch-group)
  ("M-," . centaur-tabs-backward)
  ("M-." . centaur-tabs-forward)
  :init
  (setq centaur-tabs-hide-tab-function 'centaur-tabs-hide-tab-regexps
	centaur-tabs-show-new-tab-button nil
	centaur-tabs-set-modified-marker t
	centaur-tabs-modified-marker "×"
	centaur-tabs-cycle-scope 'tabs
	x-underline-at-descent-line t
	centaur-tabs-set-bar 'over)
  :config
  (defcustom centaur-tabs-excluded-regexps '("^\\s-*\\*.*\\*$")
    "A regex list specifying which buffers to ignore."
    :group 'centaur-tabs
    :type '(repeat (choice regexp)))

  (defun centaur-tabs-hide-tab-regexps (name)
    "Do no to show buffer NAME in tabs."
    (let ((name (format "%s" name)))
      (cl-dolist (regexp centaur-tabs-excluded-regexps)
	(when (string-match-p regexp name)
	  (cl-return t)))))

  (unless (display-graphic-p)
    (set-face-attribute 'centaur-tabs-selected-modified nil :weight 'bold)
    (set-face-attribute 'centaur-tabs-selected nil :weight 'bold))

  (centaur-tabs-group-by-projectile-project))

(provide '+centaur-tabs)

;;; +centaur-tabs.el ends here
